#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    vector<int> twoSum(vector<int>& price, int target) {
        int n = price.size();
        int left = 0, right = n - 1;
        while (left < right)
        {
            int sum = price[left] + price[right];
            if (sum == target)
            {
                return { price[left], price[right] };
            }
            else if (sum < target)
            {
                left++;
            }
            else
            {
                right--;
            }
        }
        return { 0,0 };
    }
};